using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._MotionImagery
{
    /// <summary>
    /// <para>Video Multiplexer</para>
    /// <para>Creates a video file that combines an archived video stream file and an associated metadata file synchronized by a time stamp.</para>
    /// <para>创建一个视频文件，该文件将存档的视频流文件和由时间戳同步的关联元数据文件组合在一起。</para>
    /// </summary>    
    [DisplayName("Video Multiplexer")]
    public class VideoMultiplexer : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public VideoMultiplexer()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_video_file">
        /// <para>Input Video File</para>
        /// <para><xdoc>
        ///   <para>The input video file that will be converted to a FMV-compliant video file.</para>
        ///   <para>The following video file types are supported: .avi (supports H.264, not H.265), .h264, .mp2, .mp4,.m2ts,.mpeg, .mpeg2, .mpeg4, .mpg, .mpg2, .mpg4, .ps, .ts, and vob.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将转换为符合 FMV 的视频文件的输入视频文件。</para>
        ///   <para>支持以下视频文件类型：.avi（支持 H.264，而不是 H.265）、.h264、.mp2、.mp4、.m2ts、.mpeg、.mpeg2、.mpeg4、.mpg、.mpg2、.mpg4、.ps、.ts 和 vob。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_metadata_file">
        /// <para>Metadata File</para>
        /// <para><xdoc>
        ///   <para>A comma-separated values (CSV) file containing metadata about the video frames for specific times.</para>
        ///   <para>Each column represents one metadata field, and one of the columns must be a time reference. The time reference is Unix Time Stamp (seconds past 1970) multiplied by one million, which is stored as an integer. The time is stored as such so that any instant in time (down to one millionth of a second) can be referenced with an integer. Consequently, a time difference between two entries of 500,000 represents one half of a second in elapsed time.</para>
        ///   <para>The first row contains the field names for the metadata columns. These field names are listed in the FMV_Multiplexer_Field_Mapping_Template.csv file obtained from C:\Program Files\ArcGIS\Pro\Resources\FullMotionVideo, or your custom field names can be matched to their corresponding FMV field names using the template. Each subsequent row contains the metadata values for a specific time, called a time stamp.</para>
        ///   <para>The metadata field names can be in any order and should be named exactly as listed in the FMV_Multiplexer_Field_Mapping_Template.csv template to map your metadata field names to the proper FMV metadata field names.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>逗号分隔值 （CSV） 文件，包含特定时间的视频帧的元数据。</para>
        ///   <para>每列表示一个元数据字段，其中一列必须是时间引用。时间参考是 Unix 时间戳（1970 年后的秒数）乘以 100 万，后者存储为整数。时间是这样存储的，因此任何时刻（小到百万分之一秒）都可以用整数引用。因此，两个条目之间的时间差 500,000 表示经过时间的半秒。</para>
        ///   <para>第一行包含元数据列的字段名称。这些字段名称列在从 C：\Program Files\ArcGIS\Pro\Resources\FullMotionVideo 获取的 FMV_Multiplexer_Field_Mapping_Template.csv 文件中，或者可以使用模板将自定义字段名称与其相应的 FMV 字段名称进行匹配。每个后续行都包含特定时间（称为时间戳）的元数据值。</para>
        ///   <para>元数据字段名称可以按任意顺序命名，并且应完全按照FMV_Multiplexer_Field_Mapping_Template.csv模板中列出的名称命名，以便将元数据字段名称映射到正确的 FMV 元数据字段名称。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_video_file">
        /// <para>Output Video File</para>
        /// <para><xdoc>
        ///   <para>The name of the output video file, including the file extension.</para>
        ///   <para>Supported video files are as follows: .h264, .mp2, .mp4, .m2ts, .mpeg, .mpeg2, .mpeg4, .mpg, .mpg2, .mpg4, .ps, .ts, and vob.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出视频文件的名称，包括文件扩展名。</para>
        ///   <para>支持的视频文件如下：.h264、.mp2、.mp4、.m2ts、.mpeg、.mpeg2、.mpeg4、.mpg、.mpg2、.mpg4、.ps、.ts 和 vob。</para>
        /// </xdoc></para>
        /// </param>
        public VideoMultiplexer(object _in_video_file, object _metadata_file, object _out_video_file)
        {
            this._in_video_file = _in_video_file;
            this._metadata_file = _metadata_file;
            this._out_video_file = _out_video_file;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Video Multiplexer";

        public override string CallName => "ia.VideoMultiplexer";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_in_video_file, _metadata_file, _out_video_file, _metadata_mapping_file, _timeshift_file, _elevation_layer];

        /// <summary>
        /// <para>Input Video File</para>
        /// <para><xdoc>
        ///   <para>The input video file that will be converted to a FMV-compliant video file.</para>
        ///   <para>The following video file types are supported: .avi (supports H.264, not H.265), .h264, .mp2, .mp4,.m2ts,.mpeg, .mpeg2, .mpeg4, .mpg, .mpg2, .mpg4, .ps, .ts, and vob.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将转换为符合 FMV 的视频文件的输入视频文件。</para>
        ///   <para>支持以下视频文件类型：.avi（支持 H.264，而不是 H.265）、.h264、.mp2、.mp4、.m2ts、.mpeg、.mpeg2、.mpeg4、.mpg、.mpg2、.mpg4、.ps、.ts 和 vob。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Video File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_video_file { get; set; }


        /// <summary>
        /// <para>Metadata File</para>
        /// <para><xdoc>
        ///   <para>A comma-separated values (CSV) file containing metadata about the video frames for specific times.</para>
        ///   <para>Each column represents one metadata field, and one of the columns must be a time reference. The time reference is Unix Time Stamp (seconds past 1970) multiplied by one million, which is stored as an integer. The time is stored as such so that any instant in time (down to one millionth of a second) can be referenced with an integer. Consequently, a time difference between two entries of 500,000 represents one half of a second in elapsed time.</para>
        ///   <para>The first row contains the field names for the metadata columns. These field names are listed in the FMV_Multiplexer_Field_Mapping_Template.csv file obtained from C:\Program Files\ArcGIS\Pro\Resources\FullMotionVideo, or your custom field names can be matched to their corresponding FMV field names using the template. Each subsequent row contains the metadata values for a specific time, called a time stamp.</para>
        ///   <para>The metadata field names can be in any order and should be named exactly as listed in the FMV_Multiplexer_Field_Mapping_Template.csv template to map your metadata field names to the proper FMV metadata field names.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>逗号分隔值 （CSV） 文件，包含特定时间的视频帧的元数据。</para>
        ///   <para>每列表示一个元数据字段，其中一列必须是时间引用。时间参考是 Unix 时间戳（1970 年后的秒数）乘以 100 万，后者存储为整数。时间是这样存储的，因此任何时刻（小到百万分之一秒）都可以用整数引用。因此，两个条目之间的时间差 500,000 表示经过时间的半秒。</para>
        ///   <para>第一行包含元数据列的字段名称。这些字段名称列在从 C：\Program Files\ArcGIS\Pro\Resources\FullMotionVideo 获取的 FMV_Multiplexer_Field_Mapping_Template.csv 文件中，或者可以使用模板将自定义字段名称与其相应的 FMV 字段名称进行匹配。每个后续行都包含特定时间（称为时间戳）的元数据值。</para>
        ///   <para>元数据字段名称可以按任意顺序命名，并且应完全按照FMV_Multiplexer_Field_Mapping_Template.csv模板中列出的名称命名，以便将元数据字段名称映射到正确的 FMV 元数据字段名称。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Metadata File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _metadata_file { get; set; }


        /// <summary>
        /// <para>Output Video File</para>
        /// <para><xdoc>
        ///   <para>The name of the output video file, including the file extension.</para>
        ///   <para>Supported video files are as follows: .h264, .mp2, .mp4, .m2ts, .mpeg, .mpeg2, .mpeg4, .mpg, .mpg2, .mpg4, .ps, .ts, and vob.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出视频文件的名称，包括文件扩展名。</para>
        ///   <para>支持的视频文件如下：.h264、.mp2、.mp4、.m2ts、.mpeg、.mpeg2、.mpeg4、.mpg、.mpg2、.mpg4、.ps、.ts 和 vob。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Video File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_video_file { get; set; }


        /// <summary>
        /// <para>Metadata Mapping File</para>
        /// <para><xdoc>
        ///   <para>A CSV file that contains 5 columns and 87 rows and is based on the FMV_Multiplexer_Field_Mapping_Template.csv template file obtained from C:\Program Files\ArcGIS\Pro\Resources\FullMotionVideo.</para>
        ///   <para>This CSV file cross references your metadata field name to the FMV field name. Each row represents one of the standard metadata parameters, such as sensor latitude. The first two columns contain the information for the tag and MISB parameter name already provided in the form. The third column contains the field name as it appears in the Input Metadata File parameter. When the third column is populated, the software can match your metadata field names to the proper FMV metadata tags.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含 5 列和 87 行的 CSV 文件，基于从 C：\Program Files\ArcGIS\Pro\Resources\FullMotionVideo 获取的FMV_Multiplexer_Field_Mapping_Template.csv模板文件。</para>
        ///   <para>此 CSV 文件将元数据字段名称与 FMV 字段名称交叉引用。每行表示一个标准元数据参数，例如传感器纬度。前两列包含表单中已提供的标记和 MISB 参数名称的信息。第三列包含输入元数据文件参数中显示的字段名称。填充第三列后，软件可以将您的元数据字段名称与正确的 FMV 元数据标签进行匹配。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Metadata Mapping File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _metadata_mapping_file { get; set; } = null;


        /// <summary>
        /// <para>Timeshift File</para>
        /// <para><xdoc>
        ///   <para>A file containing defined time shift intervals.</para>
        ///   <para>Ideally, the video images and the metadata are synchronized in time. When this is the case, the image footprint in full motion video surrounds features that can be seen in the video image. Sometimes there is a mismatch between the timing of the video and the timing in the metadata. This leads to an apparent time delay between when a ground feature is surrounded by the image footprint and when that ground feature is visible in the video image. If this time shift is observable and consistent, the multiplexer can adjust the timing of the metadata to match the video.</para>
        ///   <para>If there is a mismatch between the timing of the video and metadata, specify the time shift in the FMV_Multiplexer_TimeShift_Template.csv template, obtained from C:\Program Files\ArcGIS\Pro\Resources\FullMotionVideo. The time shift observations file is a CSV file containing two columns (elapsed time and time shift) and one or more data rows. A row for column names is optional.</para>
        ///   <para>For example, if the video image has a 5-second lag for the entire time, the time shift observation file would have one line: 0:00, -5. The entire video is shifted 5 seconds.</para>
        ///   <para>If there is a 5-second lag at the 0:18 mark of the video, and a 9-second lag at the 2:21 mark of the video, the time shift observation file would have the following two lines:</para>
        ///   <code>0:18, -5 2:21, -9</code>
        ///   <para>In this case, the video is shifted differently at the beginning of the video and at the end of the video.</para>
        ///   <para>You can define any number of time shift intervals in the time shift observation file.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含定义的时移间隔的文件。</para>
        ///   <para>理想情况下，视频图像和元数据会及时同步。在这种情况下，全动态视频中的图像足迹会环绕视频图像中可以看到的特征。有时，视频的时序与元数据中的时序不匹配。这导致地面要素被图像封装包围与地面要素在视频图像中可见之间存在明显的时间延迟。如果此时移是可观察且一致的，则多路复用器可以调整元数据的时序以匹配视频。</para>
        ///   <para>如果视频的时序与元数据不匹配，请在 FMV_Multiplexer_TimeShift_Template.csv 模板中指定时移，该模板是从 C：\Program Files\ArcGIS\Pro\Resources\FullMotionVideo 获取的。时移观测值文件是一个 CSV 文件，包含两列（经过的时间和时移）和一个或多个数据行。列名的行是可选的。</para>
        ///   <para>例如，如果视频图像在整个时间内有 5 秒的延迟，则时移观察文件将有一行：0：00、-5。整个视频移动了 5 秒。</para>
        ///   <para>如果在视频的 0：18 标记处有 5 秒的滞后，在视频的 2：21 标记处有 9 秒的滞后，则时移观察文件将包含以下两行：</para>
        ///   <code>0:18, -5 2:21, -9</code>
        ///   <para>在这种情况下，视频在视频开头和视频结尾的移动方式不同。</para>
        ///   <para>您可以在时移观测文件中定义任意数量的时移间隔。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Timeshift File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _timeshift_file { get; set; } = null;


        /// <summary>
        /// <para>Digital Elevation Model</para>
        /// <para><xdoc>
        ///   <para>The source of the elevation needed for calculating the video frame corner coordinates. The source can be a layer, image service, or an average ground elevation or ocean depth. The average elevation value needs to include the units of measurement such as meters or feet or other measure of length.</para>
        ///   <para>The accuracy of the video footprint and frame center depends on the accuracy of the DEM data source provided. It is recommended that you provide a DEM layer or image service. If you do not have access to DEM data, you can enter an average elevation and unit relative to sea level, such as 15 feet or 10 meters. In the case of a submersible, you can enter -15 feet or -10 meters. Using an average elevation or ocean depth is not as accurate as providing a DEM or bathymetric data.</para>
        ///   <para>To calculate frame corner coordinates, the average elevation value must always be less than the sensor's altitude or depth as recorded in the metadata. For example, if the video was filmed at a sensor altitude of 10 meters and higher, a valid average elevation could be 9 meters or less. If a video was filmed underwater at a depth of -10 meters and deeper, the valid average elevation (relative to sea level) could be -11 or deeper. If the Sensor Altitude value is less than the average elevation value, the four corner coordinates will not be calculated for that record. If you do not know the average elevation of your project area, use a DEM.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>计算视频帧角坐标所需的高程源。源可以是图层、影像服务或平均地面高程或海洋深度。平均高程值需要包括测量单位，例如米或英尺或其他长度测量单位。</para>
        ///   <para>视频封装和帧中心的精度取决于所提供的 DEM 数据源的精度。建议您提供 DEM 图层或影像服务。如果您无权访问 DEM 数据，则可以输入相对于海平面的平均高程和单位，例如 15 英尺或 10 米。在潜水器的情况下，您可以进入-15英尺或-10米。使用平均高程或海洋深度不如提供 DEM 或测深数据准确。</para>
        ///   <para>要计算帧角坐标，平均高程值必须始终小于元数据中记录的传感器高度或深度。例如，如果视频是在 10 米或更高的传感器高度拍摄的，则有效平均高度可能为 9 米或更低。如果视频是在 -10 米或更深的水下拍摄的，则有效平均海拔（相对于海平面）可能为 -11 或更深。如果传感器高度值小于平均高程值，则不会计算该记录的四个角坐标。如果您不知道项目区域的平均高程，请使用 DEM。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Digital Elevation Model")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _elevation_layer { get; set; } = null;


        public VideoMultiplexer SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}